package com.hzdesk.media.koreabatchmatvector.update;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import com.hzdesk.media.koreabatchmatvector.bean.AdvertisingBeanDao;
import com.hzdesk.media.koreabatchmatvector.bean.DaoMaster;
import com.hzdesk.media.koreabatchmatvector.bean.DeviceAttributeBeanDao;
import com.hzdesk.media.koreabatchmatvector.bean.MeetInfoBeanDao;
import com.hzdesk.media.koreabatchmatvector.bean.MemoryDao;
import com.hzdesk.media.koreabatchmatvector.bean.MouseUserDevicesinfoBeanDao;
import com.hzdesk.media.koreabatchmatvector.bean.VideoFileDao;

import org.greenrobot.greendao.database.Database;

/**
 * Created by Administrator on 2018/7/21.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class MySQLiteOpenHelper extends DaoMaster.OpenHelper {
    public MySQLiteOpenHelper(Context context, String name) {
        super(context, name);
    }

    public MySQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }
    /**
     *
     * @param db
     * @param oldVersion
     * @param newVersion
     *  更新数据库的时候自己调用
     */
    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        Log.d("flag","-----调用了");
        //具体的数据转移在MigrationHelper2类中
        /**
         *  将db传入     将gen目录下的所有的Dao.类传入
         */
       MigrationHelper2.migrate(db,AdvertisingBeanDao.class, DeviceAttributeBeanDao.class, MeetInfoBeanDao.class, MemoryDao.class, MouseUserDevicesinfoBeanDao.class, VideoFileDao.class);
    }
}
